home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / prog_d / oleauttr.zip / GRAPHOLE.ZIP / GRAPHOLE.PAS < prev    next >
Pascal/Delphi Source File  |  1996-01-01  |  2KB  |  88 lines

  1. unit Graphole;
  2. {
  3. //__________________________________________________________________________
  4. // Unit File  : GRAPHOLE.PAS
  5. // Summary    :
  6. // Author     : William M. Raike
  7. // Created on : 31 Dec 1995
  8. // Project    :
  9. // Compiler   : Borland Delphi 1.0
  10. //__________________________________________________________________________
  11. //                       INTERFACE CHANGE HISTORY
  12. //  No.    When    Who    Why
  13. //  0           WMR  Original File.
  14. //
  15. //__________________________________________________________________________
  16. //
  17. // Description:
  18.       Illustration of controlling MS-GRAPH, with nested objects,
  19.       using TOLEAutoClient component.
  20. }
  21.  
  22. interface
  23.  
  24. uses
  25.   GraphCls,
  26.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  27.   Forms, Dialogs, StdCtrls, Oleauto;
  28.  
  29. type
  30.   TForm1 = class(TForm)
  31.     btnVisible: TButton;
  32.     OleAutoClient1: TOleAutoClient;
  33.     btnExit: TButton;
  34.     procedure btnVisibleClick(Sender: TObject);
  35.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  36.     procedure btnExitClick(Sender: TObject);
  37.     procedure FormCreate(Sender: TObject);
  38.   private
  39.     { Private declarations }
  40.   public
  41.     { Public declarations }
  42.   end;
  43.  
  44. var
  45.   Form1: TForm1;
  46.   GraphChart : TGraphChart;
  47.   bObExists : Boolean;
  48.  
  49. implementation
  50.  
  51. {$R *.DFM}
  52.  
  53. procedure TForm1.btnVisibleClick(Sender: TObject);
  54. begin
  55.   if bObExists then
  56.     { Toggle visibility on/off. }
  57.     GraphChart.Application.Visible := not GraphChart.Application.Visible;
  58. end;
  59.  
  60. procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
  61. begin
  62.   if bObExists then
  63.   begin
  64.     GraphChart.Release;
  65.     bObExists := False;
  66.   end;
  67. end;
  68.  
  69. procedure TForm1.FormCreate(Sender: TObject);
  70. begin
  71.   Application.ShowHint := True;
  72.   Application.HintPause := 10;
  73.  
  74.   GraphChart := TGraphChart.CreateObject('MSGraph.Chart');
  75.   if Assigned(GraphChart) then
  76.     bObExists := True;
  77.  
  78.   { Move this window to the top of the z-order. }
  79.   SetWindowPos(Handle, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE Or SWP_NOSIZE);
  80. end;
  81.  
  82. procedure TForm1.btnExitClick(Sender: TObject);
  83. begin
  84.   Close;
  85. end;
  86.  
  87. end.
  88.